import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import render from '@dfeidao/atom-web/render/render';
import p001 from './p001';
import p002 from './p002';

interface Par extends Event {
	page_no: number;
}
export default async function a001(fd: IFeidaoAiBrowserComponent, e: Par) {
	// todo
	const res = await nodejs<{ res: Array<{}>,t: number }>('knowledge-base/zj-000001/s001', {
		filter: {
			pn: e.page_no
		}
	});

	if (res.res.length > 0) {
		render(fd, res.res, p001, 'p001', 'inner');
	} else {
		render(fd, '', p002, 'p002', 'inner');
	}
}
